package player;

import character.MyCharacter;
import com.jme3.renderer.Camera;
import effect.EffectSpatial;
import game.DataStore;
import game.GameState;
import game.StateSwitcher;

public class HumanPlayer extends Player {
    protected Camera camera;
    protected Journal journal;
    protected MyCharacter selectedCharacter;
    protected EffectSpatial selectedEffectSpatial;

    @Deprecated
    protected HumanPlayer() {}

    public HumanPlayer(String name, Camera camera) {
	super(name);
	this.camera = camera;
        this.journal = new Journal(this);
    }
    
    public Camera getCamera() {
	return camera;
    }
    public Journal getJournal() {
        return journal;
    }
    public MyCharacter getSelectedCharacter() {
	return selectedCharacter;
    }
    public void setSelectedCharacter(MyCharacter selectedCharacter) {
	this.selectedCharacter = selectedCharacter;
    }
    public boolean hasSelectedCharacter() {
	return selectedCharacter != null;
    }
    public void clearSelectedCharacter() {
	if(selectedCharacter != null) {
            if(selectedCharacter.getPlayer().equals(this) && StateSwitcher.getGameState() == GameState.COMBAT && DataStore.combatAppState.getCurrentCombatActor().equals(selectedCharacter))
                DataStore.board.unhighlightCharacterMoveLocations(selectedCharacter);
	    selectedCharacter = null;
	}
    }
    public EffectSpatial getSelectedEffectSpatial() {
        return selectedEffectSpatial;
    }
    public void setSelectedEffectSpatial(EffectSpatial selectedEffectSpatial) {
        this.selectedEffectSpatial = selectedEffectSpatial;
    }
    public boolean hasSelectedEffectSpatial() {
        return selectedEffectSpatial != null;
    }
    public void clearSelectedEffectSpatial(MyCharacter character) {
        if(selectedEffectSpatial != null)
            DataStore.board.removeEffectSpatial(character, selectedEffectSpatial);
        selectedEffectSpatial = null;
    }
}
